<?php

/**
 * Event form base class.
 *
 * @method Event getObject() Returns the current form's model object
 *
 * @package    campus-plateform
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseEventForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                   => new sfWidgetFormInputHidden(),
      'title'                => new sfWidgetFormInputText(),
      'start_date'           => new sfWidgetFormDate(),
      'end_date'             => new sfWidgetFormDate(),
      'start_hours'          => new sfWidgetFormTime(),
      'end_hours'            => new sfWidgetFormTime(),
      'description'          => new sfWidgetFormTextarea(),
      'member_price'         => new sfWidgetFormInputText(),
      'no_member_price'      => new sfWidgetFormInputText(),
      'city'                 => new sfWidgetFormInputText(),
      'zip_code'             => new sfWidgetFormInputText(),
      'address'              => new sfWidgetFormInputText(),
      'deadline_inscription' => new sfWidgetFormDateTime(),
      'deadline_payment'     => new sfWidgetFormDateTime(),
      'visibility_date'      => new sfWidgetFormDateTime(),
      'email_body'           => new sfWidgetFormTextarea(),
      'email_date'           => new sfWidgetFormDateTime(),
      'reminder_email'       => new sfWidgetFormDateTime(),
      'cost'                 => new sfWidgetFormInputText(),
      'path_cover_photo'     => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'                   => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'title'                => new sfValidatorString(array('max_length' => 45)),
      'start_date'           => new sfValidatorDate(),
      'end_date'             => new sfValidatorDate(),
      'start_hours'          => new sfValidatorTime(),
      'end_hours'            => new sfValidatorTime(),
      'description'          => new sfValidatorString(),
      'member_price'         => new sfValidatorNumber(),
      'no_member_price'      => new sfValidatorNumber(),
      'city'                 => new sfValidatorString(array('max_length' => 45)),
      'zip_code'             => new sfValidatorString(array('max_length' => 45)),
      'address'              => new sfValidatorString(array('max_length' => 45)),
      'deadline_inscription' => new sfValidatorDateTime(),
      'deadline_payment'     => new sfValidatorDateTime(),
      'visibility_date'      => new sfValidatorDateTime(),
      'email_body'           => new sfValidatorString(),
      'email_date'           => new sfValidatorDateTime(),
      'reminder_email'       => new sfValidatorDateTime(),
      'cost'                 => new sfValidatorNumber(),
      'path_cover_photo'     => new sfValidatorString(array('max_length' => 255)),
    ));

    $this->widgetSchema->setNameFormat('event[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Event';
  }

}
